#-*- coding:utf-8 -*-
#main file

import sys
from constants import *
from PyQt4 import QtGui, QtCore
from main_window import MainWindow
from utils import *

def main():
    #set utf-8 code
    reload(sys)
    sys.setdefaultencoding("utf-8")

    codec = QtCore.QTextCodec.codecForName("utf-8")
    QtCore.QTextCodec.setCodecForLocale(codec)
    QtCore.QTextCodec.setCodecForCStrings(codec)
    QtCore.QTextCodec.setCodecForTr(codec)

    Utils.read_history_data()

    app = QtGui.QApplication(sys.argv)
    ctWidget = MainWindow()
    ctWidget.resize(WINDOW_WIDTH, WINDOW_HEIGHT)
    ctWidget.show()
    # x, y = __get_center_pos(
    #     ctWidget.frameSize().width(), 
    #     ctWidget.frameSize().height()
    # )
    # ctWidget.move(x, y)

    sys.exit(app.exec_())

if __name__ == '__main__':
    main()